import 'package:get_storage/get_storage.dart';

class StorageUtils {
  StorageUtils._internal() {
    _instance = this;
    _getStorage = GetStorage();
  }

  static StorageUtils? _instance;

  static late final GetStorage? _getStorage;

  static StorageUtils get instance => _instance ?? StorageUtils._internal();

  void write(String key, dynamic value) {
    _getStorage?.write(key, value);
  }

  void remove(String key) {
    _getStorage?.remove(key);
  }

  T? read<T>(String key) {
    return _getStorage?.read(key);
  }
}
